package br.com.juridico.util;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;

public class HibernateUtil {
	private static final SessionFactory sessionFactory;
	
	static{
		try{
			sessionFactory = new  AnnotationConfiguration().configure("hibernate.cfg.xml").buildSessionFactory();
		}catch (Throwable e) {
			throw new ExceptionInInitializerError(e);
		}
	}
	
 //retorna uma sessao de comunicacao com o BD
	public static SessionFactory getSessionFactory(){
		return sessionFactory;
	}
}
